function deepClone(obj) {
    return new Promise((resolve) => {
        const { port1, port2 } = new MessageChannel();
        port1.postMessage(obj);
        port2.onmessage = (e) => {
            resolve(e.data);
        }
    })

}

const obj = {
    a: 1,
    b: {
        c: 2
    },
    d: [1, 2, 3],
    e: new Date(),
    g: 1n,
    i: undefined,
    j: null,
}

deepClone(obj).then(res => {
    console.log(res);
})

